<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('科目余额表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                             <li>
								<label>核算年度：</label>
								<select name="nd" id="nd">
									<option th:each="nd : ${ndlist}" th:text="${nd}" th:value="${nd}"> th:selected="${nd==year}"> </option>
								</select>
							</li>
                            <li >
								<label>核算期间： </label><select name="yf" id="yf">
								    <option th:each="yf : ${yflist}" th:text="${yf}" th:value="${yf}" th:selected="${yf==term}"></option>
								</select>
							</li>
							 <li >
								<label>科目级别： </label><select name="kmjb" id="kmjb">
								    <option value="1">1级</option>
									<option value="2">2级</option>
									<option value="3">3级</option>
									<option value="4">4级</option>
								</select>
							</li>
							<li style="width:265px">
                                <label>起始科目：</label> 
	                                 <div class="input-group">
		                                <input class="form-control" type="text" ondblclick="selectSKmdmTree()" id="skmdm"  name="params[skmdm]">
		                        		<span class="input-group-addon"><i class="fa fa-search" onclick="selectSKmdmTree()"></i></span>
	                        		 </div> 
                            </li>
                            <li style="width:265px">
                               <label>终止科目：</label> 
	                                 <div class="input-group">
		                                <input class="form-control" type="text" ondblclick="selectEKmdmTree()" id="ekmdm"  name="params[ekmdm]">
		                        		<span class="input-group-addon"><i class="fa fa-search" onclick="selectEKmdmTree()"></i></span>
	                        		 </div> 
                            </li>
							 <li>
                                <label>未记账：</label>
                                <input type="checkbox" name="params[sfjz]" />
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
               
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:subjectbalance:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/subjectbalance";

        $(function() {
            var options = {
                url: prefix + "/list",
                exportUrl: prefix + "/export",
                modalName: "科目余额表",
                columns: [	
                [   {
					title : '科目',
					align : 'center',
					colspan : 2
					},
                	{
					title : '期初余额',
					align : 'center',
					colspan : 2
					}, {
						title : '本期发生金额',
						align : 'center',
						colspan : 2
					}, {
						title : '期末余额',
						align : 'center',
						colspan : 2
					}
				],
                [{
                    field: 'kmdm',
                    title: '科目代码',
                },{
                    field: 'kmmc',
                    title: '科目名称',
                }, 
                {
                    field: 'beginLenderMoney',
                    title: '借方'
                },
                {
                    field: 'beginBebitMoney',
                    title: '贷方'
                },
                {
                    field: 'nowLenderMoney',
                    title: '借方'
                },{
                    field: 'nowBebitMoney',
                    title: '贷方',
                },{
                    field: 'endLenderMoney',
                    title: '借方',
                },
                {
                    field: 'endBebitMoney',
                    title: '贷方'
                }]]
            };
            $.table.init(options);
        });
        
        /*会计科目-新增-选择父部门树*/
        function selectSKmdmTree() {
            var options = {
                title: '会计科目选择',
                width: "380",
                url: ctx + "system/kmdm/selectKmdmTree/",
                callBack: doSubmitStart
            };
            $.modal.openOptions(options);
        }

        function doSubmitStart(index, layero){
               var body = layer.getChildFrame('body', index);
               $("#skmdm").val(body.find('#treeId').val());
               layer.close(index);
        }
        /*会计科目-新增-选择父部门树*/
        function selectEKmdmTree() {
            var options = {
                title: '会计科目选择',
                width: "380",
                url: ctx + "system/kmdm/selectKmdmTree/",
                callBack: doSubmitEnd
            };
            $.modal.openOptions(options);
        }

        function doSubmitEnd(index, layero){
               var body = layer.getChildFrame('body', index);
               $("#ekmdm").val(body.find('#treeId').val());
               layer.close(index);
        }
    </script>
</body>
</html>